package com.sinven.serviceImpl;


import com.sinven.daoImpl.GoodsDaoImpl;
import com.sinven.entity.GoodsAllInfo;
import com.sinven.entity.GoodsSimpleInfo;
import com.sinven.service.GoodsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class GoodsServiceImpl implements GoodsService{
    @Resource
    private GoodsDaoImpl goodsDao;

    @Override
    public List<GoodsSimpleInfo> seachSimpleGoodsInfo() {

        System.out.println(goodsDao);
        String hql = "select new com.sinven.entity.GoodsSimpleInfo(g.id,g.name,g.retailPrice,g.marketPrice,gg.imgUrl) from Goods g,GoodsGallery gg where g.id = gg.goodsId";
        return goodsDao.findGoodsInfo(hql);
    }

    @Override
    public List<GoodsAllInfo> seachAllGoodsInfo() {
        String hql = "";
        return goodsDao.findGoodsAllInfo(hql);
    }
}
